import koa from "koa";
import cors from "koa2-cors";
import { mysql } from "./core/db";
import router from './routes/index';

mysql.main()//删除词句,db启动时不会调用

//监听全局错误
process.on('unhandledRejection', (reason) =>
{
    console.log("全局捕获错误:",reason); // 打印"Hello, Fundebug!"
});

//启动http服务
let app:koa = new koa()
app.use(cors())
app.use(router.routes());
app.listen(8010, () => {
    console.log("http启动成功:http://localhost:8010");
});